// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import './element.js'


import 'element-ui/lib/theme-chalk/index.css'
import './assets/css/global.css'
import './assets/font/iconfont.css'
// 引入 vue-table-with-tree-grid 组件
import TableTree from 'vue-table-with-tree-grid'
// 引入 vue-quill-editor 富文本框组件
import VueQuillEditor from "vue-quill-editor/src"
// 引入 vue-quill-editor 富文本框样式
import 'quill/dist/quill.core.css' // import styles
import 'quill/dist/quill.snow.css' // for snow theme
import 'quill/dist/quill.bubble.css' // for bubble theme

// 挂在 vue-quill-editor 富文本框组件
Vue.use(VueQuillEditor)
// 导入并配置axios
import axios from "axios";
axios.defaults.baseURL='http://timemeetyou.com:8889/api/private/v1/'
//配置axios 拦截器
axios.interceptors.request.use(config => {
  // 为header 配置Authorization
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config;
})
Vue.prototype.$http=axios

Vue.component('table-tree', TableTree)

Vue.filter('dateFormat', function(originDate) {
  let date = new Date(originDate * 1000)
  let year = date.getFullYear()
  let month = (date.getMonth() + '').padStart(2, '0');
  let dayOfMonth = (date.getDate() + '').padStart(2, '0');
  let hour = (date.getHours() + '').padStart(2, '0');
  let minute = (date.getMinutes() + '').padStart(2, '0');
  let formatDatetime = year + '-' + month + '-' + dayOfMonth + ' ' + hour + ':' + minute
  return formatDatetime

})

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
